
DLL_FILES := readud.dll lSDL.dll lgl.dll drw.dll lSDL_image.dll lSDL_mixer.dll lSDL_ttf.dll dcall.dll

all:$(DLL_FILES)

CFLAGS += -lluajit-5.1.dll -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf\
	-O2 \
	-I/k/lib/mingw-w64-i686-luajit-git-v2.0.4.26.g62af101-1-any.pkg/mingw32/include/luajit-2.0 \
	-L/k/lib/mingw-w64-i686-luajit-git-v2.0.4.26.g62af101-1-any.pkg/mingw32/lib

clean:
	-rm $(DLL_FILES)
	
test:all
	lua test.lua

%.dll:%.c
	gcc -shared $(<)  -lopengl32 $(CFLAGS) -o $(@)

lSDL.dll:lsdl2.c
	gcc -shared $(<)  $(CFLAGS) -o $(@)
	
drw.dll:../../clib/drw.c
	gcc -shared $(<)  $(CFLAGS) -o $(@)
	
dcall.dll:../../clib/dcall.c
	gcc -shared $(<)  $(CFLAGS) -o $(@)

dcallback.dll:../../clib/dcallback.c
	gcc -shared $(<)  $(CFLAGS) -o $(@)

lgtk.dll:lgtk.c
	gcc -shared $(<)  `pkg-config --cflags --libs gtk+-3.0` $(CFLAGS) -o $(@)

callbackfunc.dll:../../clib/callbackfunc.c
	gcc -shared $(<)  $(CFLAGS) -o $(@)
